﻿<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US">
<head>
    <meta charset="utf-8">
    <meta name="renderer" content="webkit|ie-comp|ie-stand">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport"
          content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no"/>
    <meta http-equiv="Cache-Control" content="no-siteapp"/>
    <!--[if lt IE 9]>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/HuiAdmin/lib/html5.js"></script>
    <script type="text/javascript" src="${pageContext.request.contextPath}/static/HuiAdmin/lib/respond.min.js"></script>
    <![endif]-->
    <link href="${pageContext.request.contextPath}/static/HuiAdmin/static/h-ui/css/H-ui.min.css" rel="stylesheet" type="text/css"/>
    <link href="${pageContext.request.contextPath}/static/HuiAdmin/static/h-ui.admin/css/H-ui.login.css" rel="stylesheet" type="text/css"/>
    <link href="${pageContext.request.contextPath}/static/HuiAdmin/static/h-ui.admin/css/style.css" rel="stylesheet" type="text/css"/>
    <link href="${pageContext.request.contextPath}/static/HuiAdmin/lib/Hui-iconfont/1.0.8/iconfont.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<input type="hidden" id="TenantId" name="TenantId" value=""/>
<div class="">
    <div class="loginBox" style="background: url('..')">
        <form class="form form-horizontal" action="${pageContext.request.contextPath}/account/login.do" method="post" id="loginForm">
            <div class="row cl">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60d;</i></label>
                <div class="formControls col-xs-8">
                    <input id="accountId" name="accountId" type="text" placeholder="账户" class="input-text size-L">
                </div>
            </div>
            <div class="row cl">
                <label class="form-label col-xs-3"><i class="Hui-iconfont">&#xe60e;</i></label>
                <div class="formControls col-xs-8">
                    <input id="accountPwd" name="accountPwd" type="password" placeholder="密码" class="input-text size-L">
                </div>
            </div>
            <div class="row cl">
                <div class="formControls col-xs-8 col-xs-offset-3">
                    <%--<label for="online">--%>
                        <%--<input type="checkbox" name="online" id="online" value="">--%>
                        <%--使我保持登录状态</label>--%>
                    <label id="msg"> </label>
                </div>
            </div>
            <div class="row cl">
                <div class="formControls col-xs-8 col-xs-offset-3">
                    <input name="" type="button" class="btn btn-success radius size-L"
                           value="&nbsp;登&nbsp;&nbsp;&nbsp;&nbsp;录&nbsp;" onclick="checkLogin()">
                    <input name="" type="reset" class="btn btn-default radius size-L"
                           value="&nbsp;取&nbsp;&nbsp;&nbsp;&nbsp;消&nbsp;">
                </div>
            </div>
        </form>
    </div>
</div>


<script type="text/javascript" src="${pageContext.request.contextPath}/static/HuiAdmin/lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="${pageContext.request.contextPath}/static/HuiAdmin/static/h-ui/js/H-ui.js"></script>
<script type="text/javascript">
    function setMsg(sMsg){
        $("#msg").html('');
        $("#msg").html('<font color="red">'+ sMsg + '</font>');
    }
    function checkLogin() {
        var sAccout = $("#accountId").val();
        var sPwd = $("#accountPwd").val();
        if(sAccout.length == 0){
            setMsg("请输入用户名");
            return;
        }
        if(sPwd.length == 0){
            setMsg("请输入密码");
            return;
        }
        var myDate = new Date();
        var sTime = myDate.toLocaleString();
        $.ajax({
            type: "POST",
            url: $("#loginForm").attr("action"),
            data: {
                sAccount: sAccout,
                sPwd: sPwd,
                sTime: sTime,
            },
            dataType: "json",
            success: function (data) {
                if(data.isSuccessed == true){
                    if(typeof (data.data) != "undefined"){
                        var sInfo = window.localStorage;
                        sInfo.setItem("userId", data.data.accId);
                        sInfo.setItem("token",data.data.token);
                        sInfo.setItem("time",data.data.effectTime);
                        sInfo.setItem("acc", data.msg);
                        var index = parent.layer.getFrameIndex(window.name);
                        parent.$("#reload").click();
                        parent.layer.close(index);
                    }
                }else {
                    setMsg(data.msg);
                }

            }
        });
    }
</script>
</body>
</html>